|
1
|
|
|
/*! |
|
2
|
|
|
* Bootstrap popover.js v4.6.1 (https://getbootstrap.com/) |
|
3
|
|
|
* Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) |
|
4
|
|
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) |
|
5
|
|
|
*/ |
|
6
|
|
|
(function (global, factory) { |
|
7
|
|
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('jquery'), require('./tooltip.js')) : |
|
8
|
|
|
typeof define === 'function' && define.amd ? define(['jquery', './tooltip'], factory) : |
|
|
|
|
|
|
9
|
|
|
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Popover = factory(global.jQuery, global.Tooltip)); |
|
|
|
|
|
|
10
|
|
|
})(this, (function ($, Tooltip) { 'use strict'; |
|
11
|
|
|
|
|
12
|
|
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } |
|
13
|
|
|
|
|
14
|
|
|
var $__default = /*#__PURE__*/_interopDefaultLegacy($); |
|
15
|
|
|
var Tooltip__default = /*#__PURE__*/_interopDefaultLegacy(Tooltip); |
|
16
|
|
|
|
|
17
|
|
|
function _defineProperties(target, props) { |
|
18
|
|
|
for (var i = 0; i < props.length; i++) { |
|
19
|
|
|
var descriptor = props[i]; |
|
20
|
|
|
descriptor.enumerable = descriptor.enumerable || false; |
|
21
|
|
|
descriptor.configurable = true; |
|
22
|
|
|
if ("value" in descriptor) descriptor.writable = true; |
|
|
|
|
|
|
23
|
|
|
Object.defineProperty(target, descriptor.key, descriptor); |
|
24
|
|
|
} |
|
25
|
|
|
} |
|
26
|
|
|
|
|
27
|
|
|
function _createClass(Constructor, protoProps, staticProps) { |
|
28
|
|
|
if (protoProps) _defineProperties(Constructor.prototype, protoProps); |
|
|
|
|
|
|
29
|
|
|
if (staticProps) _defineProperties(Constructor, staticProps); |
|
|
|
|
|
|
30
|
|
|
return Constructor; |
|
31
|
|
|
} |
|
32
|
|
|
|
|
33
|
|
|
function _extends() { |
|
34
|
|
|
_extends = Object.assign || function (target) { |
|
35
|
|
|
for (var i = 1; i < arguments.length; i++) { |
|
36
|
|
|
var source = arguments[i]; |
|
37
|
|
|
|
|
|
|
|
|
|
38
|
|
|
for (var key in source) { |
|
39
|
|
|
if (Object.prototype.hasOwnProperty.call(source, key)) { |
|
40
|
|
|
target[key] = source[key]; |
|
41
|
|
|
} |
|
|
|
|
|
|
42
|
|
|
} |
|
43
|
|
|
} |
|
44
|
|
|
|
|
45
|
|
|
return target; |
|
46
|
|
|
}; |
|
47
|
|
|
|
|
48
|
|
|
return _extends.apply(this, arguments); |
|
49
|
|
|
} |
|
50
|
|
|
|
|
51
|
|
|
function _inheritsLoose(subClass, superClass) { |
|
52
|
|
|
subClass.prototype = Object.create(superClass.prototype); |
|
53
|
|
|
subClass.prototype.constructor = subClass; |
|
54
|
|
|
|
|
55
|
|
|
_setPrototypeOf(subClass, superClass); |
|
56
|
|
|
} |
|
57
|
|
|
|
|
58
|
|
|
function _setPrototypeOf(o, p) { |
|
59
|
|
|
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { |
|
60
|
|
|
o.__proto__ = p; |
|
61
|
|
|
return o; |
|
62
|
|
|
}; |
|
63
|
|
|
|
|
64
|
|
|
return _setPrototypeOf(o, p); |
|
65
|
|
|
} |
|
66
|
|
|
|
|
67
|
|
|
/** |
|
68
|
|
|
* Constants |
|
69
|
|
|
*/ |
|
70
|
|
|
|
|
71
|
|
|
var NAME = 'popover'; |
|
72
|
|
|
var VERSION = '4.6.1'; |
|
73
|
|
|
var DATA_KEY = 'bs.popover'; |
|
74
|
|
|
var EVENT_KEY = "." + DATA_KEY; |
|
75
|
|
|
var JQUERY_NO_CONFLICT = $__default["default"].fn[NAME]; |
|
76
|
|
|
var CLASS_PREFIX = 'bs-popover'; |
|
77
|
|
|
var BSCLS_PREFIX_REGEX = new RegExp("(^|\\s)" + CLASS_PREFIX + "\\S+", 'g'); |
|
78
|
|
|
var CLASS_NAME_FADE = 'fade'; |
|
79
|
|
|
var CLASS_NAME_SHOW = 'show'; |
|
80
|
|
|
var SELECTOR_TITLE = '.popover-header'; |
|
81
|
|
|
var SELECTOR_CONTENT = '.popover-body'; |
|
82
|
|
|
|
|
83
|
|
|
var Default = _extends({}, Tooltip__default["default"].Default, { |
|
84
|
|
|
placement: 'right', |
|
85
|
|
|
trigger: 'click', |
|
86
|
|
|
content: '', |
|
87
|
|
|
template: '<div class="popover" role="tooltip">' + '<div class="arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div></div>' |
|
88
|
|
|
}); |
|
89
|
|
|
|
|
90
|
|
|
var DefaultType = _extends({}, Tooltip__default["default"].DefaultType, { |
|
91
|
|
|
content: '(string|element|function)' |
|
92
|
|
|
}); |
|
93
|
|
|
|
|
94
|
|
|
var Event = { |
|
95
|
|
|
HIDE: "hide" + EVENT_KEY, |
|
96
|
|
|
HIDDEN: "hidden" + EVENT_KEY, |
|
97
|
|
|
SHOW: "show" + EVENT_KEY, |
|
98
|
|
|
SHOWN: "shown" + EVENT_KEY, |
|
99
|
|
|
INSERTED: "inserted" + EVENT_KEY, |
|
100
|
|
|
CLICK: "click" + EVENT_KEY, |
|
101
|
|
|
FOCUSIN: "focusin" + EVENT_KEY, |
|
102
|
|
|
FOCUSOUT: "focusout" + EVENT_KEY, |
|
103
|
|
|
MOUSEENTER: "mouseenter" + EVENT_KEY, |
|
104
|
|
|
MOUSELEAVE: "mouseleave" + EVENT_KEY |
|
105
|
|
|
}; |
|
106
|
|
|
/** |
|
107
|
|
|
* Class definition |
|
108
|
|
|
*/ |
|
109
|
|
|
|
|
110
|
|
|
var Popover = /*#__PURE__*/function (_Tooltip) { |
|
111
|
|
|
_inheritsLoose(Popover, _Tooltip); |
|
112
|
|
|
|
|
113
|
|
|
function Popover() { |
|
114
|
|
|
return _Tooltip.apply(this, arguments) || this; |
|
115
|
|
|
} |
|
116
|
|
|
|
|
117
|
|
|
var _proto = Popover.prototype; |
|
118
|
|
|
|
|
119
|
|
|
// Overrides |
|
120
|
|
|
_proto.isWithContent = function isWithContent() { |
|
121
|
|
|
return this.getTitle() || this._getContent(); |
|
122
|
|
|
}; |
|
123
|
|
|
|
|
124
|
|
|
_proto.addAttachmentClass = function addAttachmentClass(attachment) { |
|
125
|
|
|
$__default["default"](this.getTipElement()).addClass(CLASS_PREFIX + "-" + attachment); |
|
126
|
|
|
}; |
|
127
|
|
|
|
|
128
|
|
|
_proto.getTipElement = function getTipElement() { |
|
129
|
|
|
this.tip = this.tip || $__default["default"](this.config.template)[0]; |
|
130
|
|
|
return this.tip; |
|
131
|
|
|
}; |
|
132
|
|
|
|
|
133
|
|
|
_proto.setContent = function setContent() { |
|
134
|
|
|
var $tip = $__default["default"](this.getTipElement()); // We use append for html objects to maintain js events |
|
135
|
|
|
|
|
136
|
|
|
this.setElementContent($tip.find(SELECTOR_TITLE), this.getTitle()); |
|
137
|
|
|
|
|
138
|
|
|
var content = this._getContent(); |
|
139
|
|
|
|
|
140
|
|
|
if (typeof content === 'function') { |
|
141
|
|
|
content = content.call(this.element); |
|
142
|
|
|
} |
|
143
|
|
|
|
|
144
|
|
|
this.setElementContent($tip.find(SELECTOR_CONTENT), content); |
|
145
|
|
|
$tip.removeClass(CLASS_NAME_FADE + " " + CLASS_NAME_SHOW); |
|
146
|
|
|
} // Private |
|
147
|
|
|
; |
|
148
|
|
|
|
|
149
|
|
|
_proto._getContent = function _getContent() { |
|
150
|
|
|
return this.element.getAttribute('data-content') || this.config.content; |
|
151
|
|
|
}; |
|
152
|
|
|
|
|
153
|
|
|
_proto._cleanTipClass = function _cleanTipClass() { |
|
154
|
|
|
var $tip = $__default["default"](this.getTipElement()); |
|
155
|
|
|
var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX); |
|
156
|
|
|
|
|
157
|
|
|
if (tabClass !== null && tabClass.length > 0) { |
|
158
|
|
|
$tip.removeClass(tabClass.join('')); |
|
159
|
|
|
} |
|
160
|
|
|
} // Static |
|
161
|
|
|
; |
|
162
|
|
|
|
|
163
|
|
|
Popover._jQueryInterface = function _jQueryInterface(config) { |
|
164
|
|
|
return this.each(function () { |
|
165
|
|
|
var data = $__default["default"](this).data(DATA_KEY); |
|
166
|
|
|
|
|
167
|
|
|
var _config = typeof config === 'object' ? config : null; |
|
168
|
|
|
|
|
169
|
|
|
if (!data && /dispose|hide/.test(config)) { |
|
170
|
|
|
return; |
|
171
|
|
|
} |
|
172
|
|
|
|
|
173
|
|
|
if (!data) { |
|
174
|
|
|
data = new Popover(this, _config); |
|
175
|
|
|
$__default["default"](this).data(DATA_KEY, data); |
|
176
|
|
|
} |
|
177
|
|
|
|
|
178
|
|
|
if (typeof config === 'string') { |
|
179
|
|
|
if (typeof data[config] === 'undefined') { |
|
180
|
|
|
throw new TypeError("No method named \"" + config + "\""); |
|
181
|
|
|
} |
|
182
|
|
|
|
|
183
|
|
|
data[config](); |
|
184
|
|
|
} |
|
185
|
|
|
}); |
|
186
|
|
|
}; |
|
187
|
|
|
|
|
188
|
|
|
_createClass(Popover, null, [{ |
|
189
|
|
|
key: "VERSION", |
|
190
|
|
|
get: // Getters |
|
191
|
|
|
function get() { |
|
192
|
|
|
return VERSION; |
|
193
|
|
|
} |
|
194
|
|
|
}, { |
|
195
|
|
|
key: "Default", |
|
196
|
|
|
get: function get() { |
|
197
|
|
|
return Default; |
|
198
|
|
|
} |
|
199
|
|
|
}, { |
|
200
|
|
|
key: "NAME", |
|
201
|
|
|
get: function get() { |
|
202
|
|
|
return NAME; |
|
203
|
|
|
} |
|
204
|
|
|
}, { |
|
205
|
|
|
key: "DATA_KEY", |
|
206
|
|
|
get: function get() { |
|
207
|
|
|
return DATA_KEY; |
|
208
|
|
|
} |
|
209
|
|
|
}, { |
|
210
|
|
|
key: "Event", |
|
211
|
|
|
get: function get() { |
|
212
|
|
|
return Event; |
|
213
|
|
|
} |
|
214
|
|
|
}, { |
|
215
|
|
|
key: "EVENT_KEY", |
|
216
|
|
|
get: function get() { |
|
217
|
|
|
return EVENT_KEY; |
|
218
|
|
|
} |
|
219
|
|
|
}, { |
|
220
|
|
|
key: "DefaultType", |
|
221
|
|
|
get: function get() { |
|
222
|
|
|
return DefaultType; |
|
223
|
|
|
} |
|
224
|
|
|
}]); |
|
225
|
|
|
|
|
226
|
|
|
return Popover; |
|
227
|
|
|
}(Tooltip__default["default"]); |
|
228
|
|
|
/** |
|
229
|
|
|
* jQuery |
|
230
|
|
|
*/ |
|
231
|
|
|
|
|
232
|
|
|
|
|
233
|
|
|
$__default["default"].fn[NAME] = Popover._jQueryInterface; |
|
234
|
|
|
$__default["default"].fn[NAME].Constructor = Popover; |
|
235
|
|
|
|
|
236
|
|
|
$__default["default"].fn[NAME].noConflict = function () { |
|
237
|
|
|
$__default["default"].fn[NAME] = JQUERY_NO_CONFLICT; |
|
238
|
|
|
return Popover._jQueryInterface; |
|
239
|
|
|
}; |
|
240
|
|
|
|
|
241
|
|
|
return Popover; |
|
242
|
|
|
|
|
243
|
|
|
})); |
|
244
|
|
|
//# sourceMappingURL=popover.js.map |
|
245
|
|
|
|
This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.
To learn more about declaring variables in Javascript, see the MDN.